<template>
  <div>
    <header class="header-bar">
      <a href="/#/index"><span class="mui-icon mui-icon-arrowleft" ></span></a> 
      <p>购物车</p>
      <span class="mui-icon mui-icon-bars"    @click="seen=!seen"></span>
    </header>
    <div class="sort" v-if="seen"  >
      <ul class="f_ul">
           <li>
             <router-link to="/index"> 
               <img src="../../images/liushuxue/home_icon_new.png" alt="">
               <p>首页</p>
             </router-link>
           </li>
           <li>
             <router-link to="/sort">
               <!-- //img02.hua.com/m/icon/classify_icon_new.png -->
               <img class="aaa" src="../../images/liushuxue/classify_icon_new.png" alt="">
               <p>分类</p>
             </router-link>
           </li>
           <li>
             <router-link to="/shoppingCart">
               <img src="../../images/liushuxue/cart_icon_new.png" alt="">
               <p>购物车</p>
             </router-link>
           </li>
           <li>
             <router-link to="/mine">
               <img src="../../images/liushuxue/my_icon_new.png" alt="">
               <p>我的</p>
             </router-link>
           </li>
         </ul>
    </div>
    <!-- 购物车主体内容 -->
    <div class="concent" v-infinite-scroll="loadMore">
      <div class="list-item" v-for="item in shopp" :key="item.id">
        <label>
          <input type="checkbox" value=""     @click="togglelable">
          <span class="iconfont fontchecked" v-bind:class="{ 'icon-weixuanzhong' : isB, 'icon-choose': !isB}"></span>
        </label>
        <a href="javascript" class="imga">
            <img :src="item.img" alt="">
          </a>
        <div class="p-right">
          <p class="p-top">
            <a href="">{{item.title}}</a>
          </p>
          <div class="p-bottom">
            <span class="p-price">&yen;{{item.price}}</span>
            <!-- 数量加减 -->
            <div id="numbox">
              <span class="inputleft" type="button">-</span>
              <input class="numinput" type="number" value="0" onfocus="this.blur()"/>
              <span class="inputright" type="button">+</span>
            </div>
            <a href="javascript:;" class="del">删除</a>
          </div>
        </div>
      </div>



      <div class="kongbai"></div>
      <!-- 推荐部分 -->
      <div class="recommend">
        <p class="recommend-nav">
          <a href="" class="like-left" v-bind:class='{ "active" : isA}' @click="toggle()" @click.prevent="flag=true">购买该商品的还购买了</a>
          <a href="" class="fl-right" v-bind:class='{ "active" : !isA}' @click="toggle()" @click.prevent="flag=false">巧克力/花瓶</a>
        </p>
        <like v-if="flag"></like>
        <chocolate v-else></chocolate>
      </div>
    </div>
    <footer>
      <p>合计:<span>&yen;0</span></p>
      <a href="javascript:;">去结算(0)</a>
    </footer>
  </div>
</template>
<script>
import "./shoppfont/iconfont.css";
import Vue from "vue";
import like from './like.vue'
import chocolate from './chocolate.vue'
import { InfiniteScroll } from "mint-ui";
Vue.use(InfiniteScroll);
export default {
  data() {
    return { 
      seen: false,
      isA: true,
      flag: true,
      isB: true,
      shopp:[
      {"img":"/src/images/shopping/9012177.jpg_220x240.jpg",  "title":"[鲜花]不变的承诺",
        "price":"699",
        "num":"103",
        "id":"1"},
      {"img":"/src/images/shopping/1073017.jpg_80x87.jpg",  "title":"[礼品]一生的承诺",
        "price":"298",
        "num":"103",
        "id":"2"},
      {"img":"/src/images/shopping/9012223.jpg_220x240.jpg",  "title":"[鲜花]我只钟情你",
        "price":"258",
        "num":"103",
        "id":"3"},
      {"img":"/src/images/shopping/9012284.jpg_220x240.jpg",  "title":"[鲜花]「熊抱花束」喜欢你 ",
        "price":"718",
        "num":"103",
        "id":"4"}
        ]
     };
  },
  methods: {
    loadMore() {
      // this.loading = true;
      // setTimeout(() => {
      //   let last = this.shopp[this.shopp.length - 1];
      //   for (let i = 1; i <= 10; i++) {
      //     this.shopp.push(last + i);
      //   }
      //   this.loading = false;
      // }, 2500);
    },
    toggle () {
      this.isA = !this.isA;
    },
    togglelable () {
      this.isB = !this.isB;
    }
  },
  components: {
    like,
    chocolate
  }
  
};
</script>
<style lang="css" scoped>
a {
  color: #000;
}
/* 头部导航栏 */
.header-bar {
  height: 44px;
  width: 100%;
  background-color: #f8f8f8;
  border-bottom: 1px solid #e4e4e4;
  padding: 0 12px;
  position: relative;
}
.header-bar p {
  font-size: 16px;
  line-height: 44px;
  text-align: center;
  color: #000;
}
.header-bar .mui-icon-arrowleft {
  position: absolute;
  top: 12px;
  left: 12px;
}
.header-bar .mui-icon-bars {
  position: absolute;
  top: 12px;
  right: 12px;
}
/* 分类部分 */
.sort {
  padding:3px 0;
  width: 100%;
  background-color: #fff;
  height: 48px;
  border-bottom: 1px solid #e4e4e4;
}
.f_ul {
  overflow: hidden;
  margin-bottom: 3px;
}
.f_ul li {
  float: left;
  width: 25%;
}
.f_ul li a {
  text-align: center;
  display: block;
}
.f_ul li a img {
  width: 20px;
  height: 20px;
}
.f_ul li a p {
  margin-top: 3px;
  font-size: 10px;
  color: #494949;
  margin-bottom: 2px;
}
/* 购物主体 */
.concent .list-item {
  background-color: #fff;
  height: 110px;
  margin: 0 auto;
  padding: 12px 16px 12px 10px;
  border-bottom: 1px solid #e4e4e4;
}
.concent .list-item label {
  height: 86px;
  width: 10%;
  position: relative;
  float: left;
}
.concent .list-item label input {
  display: none;
}
.concent .list-item label .fontchecked {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translateX(-50%) translateY(-50%);
}
.concent .list-item .imga img {
  width: 80px;
  float: left;
  max-height: 85px;
}
.concent .list-item .p-right {
  padding-left: 16px;
  color: #232323;
  height: 100%;
  float: left;
  position: relative;
  font-size: 12px;
  width: calc(90% - 80px);
}
.concent .list-item .p-right .p-bottom .p-price {
  color: #fe6600;
  position: absolute;
  left: 16px;
  bottom: 0;
}
.concent .list-item .p-right .p-bottom #numbox {
  height: 22px;
  width: 78px;
  position: absolute;
  bottom: 0;
  right: 40px;
  border: 1px solid #ccc;
}
.concent .list-item .p-right .p-bottom #numbox span {
  display: block;
  width: 20px;
  height: 20px;
  float: left;
  border-right: 1px solid #ccc;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
}
.concent .list-item .p-right .p-bottom #numbox span:last-child {
  border-left:  1px solid #ccc;
  border-right: 0;
}
.concent .list-item .p-right .p-bottom #numbox input {
  width: 36px;
  height: 20px;
  float: left;
  padding: 0;
  margin: 0;
  border: 0;
  text-align: center;
}





.concent .list-item .p-right .p-bottom .del {
  color: #666;
  position: absolute;
  right: 0;
  bottom: 0;
}
.concent .kongbai {
  height: 20px;
  width: 100%;
  background-color: #fff;
}
/* 推荐商品 */
.concent .recommend {
  padding: 10px 16px 10px 10px;
  border-top: 1px solid #e4e4e4;
  border-bottom: 1px solid #e4e4e4;
  margin-top: 10px;
  margin-bottom: 60px;
  background-color: #fff;
}
.concent .recommend .recommend-nav {
  padding-bottom: 10px;
  width: 100%;
}
.concent .recommend .recommend-nav .like-left {
  display: inline-block;
  border-right: 1px solid #ccc; 
  width: 60%;
  text-align: center;
  box-sizing: border-box;
}
.concent .recommend .recommend-nav .fl-right {
  display: inline-block;
  width: 38%;
  text-align: center;
}
.concent .recommend .recommend-nav .active {
  color: #fe6600;
}
/* 页脚 */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  height: 49px;
  border-top: 1px solid #ccc; 
  width: 100%;
  background-color: #fff;
}
footer p {
  height: 49px;
  line-height: 49px;
  float: left;
  margin-left: 24px;
}
footer p span {
  color: #fe6600;
  font-size: 16px;
}
footer a {
  display: block;
  float: right;
  height: 49px;
  width: 123px;
  line-height: 49px;
  text-align: center;
  background-color: #fe6600;
  color: #fff;
}
.icon-choose {
  color: #fe6600;
}
</style>


